<?php
/**
 *    Copyright 2010 Show Framework(www.showframework.cn)
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 * 
 *        http://www.apache.org/licenses/LICENSE-2.0
 * 
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

/**
 * 系统默认视图
 * 根据不同需要，继承此类，并且重写show()方法
 * 用户自己写的视图类，最好直接继承这个类，以保证可用性
 * 
 * @package Show
 * @name Show_View
 * @author show
 * @since v0.6
 */
class Show_View implements Show_View_Interface
{
    /**
     * 视图的属性
     *
     * @var array
     */
    private $propertys;
    
    /**
     * 系统视图构造函数
     * 
     * @return void
     */
    public function __construct()
    {
        $this->propertys = array();
    }
    
    /**
     * 设置属性
     *
     * @param string $name 属性名称
     * @param mixed $value 属性值
     * @return void
     */
    public function assign($name, $value)
    {
        $this->propertys[$name] = $value;
    }
    
    /**
     * 获得属性
     *
     * @return array
     */
    public function getPropertys()
    {
        return $this->propertys;
    }
    
    /**
     * 展现视图
     * 系统视图不对视图如何展示做实现，视图的实现是各种各样的
     * 可以是原生的php+html，可以是模板引擎，可以是json/xml数据....
     * 
     * @return void
     */
    public function show()
    {
        
    }
    
    /**
     * 获取某个属性值
     *
     * @param string $name 属性名称
     * @return mixed
     */
    public function get($name)
    {
        return $this->propertys[$name];
    }
}
?>